diff options
Diffstat (limited to 'examples/blog-multiple-authors/src/pages/posts/[...page].astro')
-rw-r--r-- | examples/blog-multiple-authors/src/pages/posts/[...page].astro | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/examples/blog-multiple-authors/src/pages/posts/[...page].astro b/examples/blog-multiple-authors/src/pages/posts/[...page].astro index f770aadb2..8a6c9a730 100644 --- a/examples/blog-multiple-authors/src/pages/posts/[...page].astro +++ b/examples/blog-multiple-authors/src/pages/posts/[...page].astro @@ -1,13 +1,15 @@ --- -import MainHead from '../../components/MainHead.astro'; -import Nav from '../../components/Nav.astro'; -import PostPreview from '../../components/PostPreview.astro'; -import Pagination from '../../components/Pagination.astro'; -import authorData from '../../data/authors.json'; +import MainHead from "../../components/MainHead.astro"; +import Nav from "../../components/Nav.astro"; +import PostPreview from "../../components/PostPreview.astro"; +import Pagination from "../../components/Pagination.astro"; +import authorData from "../../data/authors.json"; export async function getStaticPaths({ paginate, rss }) { - const allPosts = await Astro.glob('../post/*.md'); - const sortedPosts = allPosts.sort((a, b) => new Date(b.frontmatter.date).valueOf() - new Date(a.frontmatter.date).valueOf()); + const allPosts = await Astro.glob("../post/*.md"); + const sortedPosts = allPosts.sort( + (a, b) => new Date(b.frontmatter.date).valueOf() - new Date(a.frontmatter.date).valueOf() + ); // Generate an RSS feed from this collection of posts. // NOTE: This is disabled by default, since it requires `site` to be set in your "astro.config.mjs" file. @@ -28,8 +30,8 @@ export async function getStaticPaths({ paginate, rss }) { } // page -const title = 'Don’s Blog'; -const description = 'An example blog on Astro'; +const title = "Don’s Blog"; +const description = "An example blog on Astro"; const { canonicalURL } = Astro; const { page } = Astro.props; --- @@ -37,7 +39,14 @@ const { page } = Astro.props; <html lang="en"> <head> <title>{title}</title> - <MainHead {title} {description} image={page.data[0].frontmatter.image} canonicalURL={canonicalURL.toString()} prev={page.url.prev} next={page.url.next} /> + <MainHead + {title} + {description} + image={page.data[0].frontmatter.image} + canonicalURL={canonicalURL.toString()} + prev={page.url.prev} + next={page.url.next} + /> <style lang="scss"> .title { @@ -62,7 +71,9 @@ const { page } = Astro.props; <main class="wrapper"> <h2 class="title">All Posts</h2> <small class="count">{page.start + 1}–{page.end + 1} of {page.total}</small> - {page.data.map((post) => <PostPreview post={post} author={authorData[post.frontmatter.author]} />)} + {page.data.map((post) => ( + <PostPreview post={post} author={authorData[post.frontmatter.author]} /> + ))} </main> <footer> |